package com.jctrip.hotel.source.client;

import java.util.List;
import java.util.Map;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;

import com.jctrip.hotel.source.model.dossen.DossenAddOrderReq;
import com.jctrip.hotel.source.model.dossen.DossenCancelOrderReq;
import com.jctrip.hotel.source.model.dossen.DossenCheckPriceAndCountReq;
import com.jctrip.hotel.source.model.dossen.DossenCityData;
import com.jctrip.hotel.source.model.dossen.DossenGetHotelInfoReq;
import com.jctrip.hotel.source.model.dossen.DossenGetHotelRoomTypeReq;
import com.jctrip.hotel.source.model.dossen.DossenGetOrdersReq;
import com.jctrip.hotel.source.model.dossen.DossenGetPriceAndCountReq;
import com.jctrip.hotel.source.model.dossen.DossenHotelData;
import com.jctrip.hotel.source.model.dossen.DossenOrderData;
import com.jctrip.hotel.source.model.dossen.DossenPriceAndCountData;
import com.jctrip.hotel.source.model.dossen.DossenRatePlanData;
import com.jctrip.hotel.source.model.dossen.DossenResult;
import com.jctrip.hotel.source.model.dossen.DossenRoomTypeData;

/**
 * @Author henry
 * @Date 2023/6/6 21:44
 * @Description
 */
@FeignClient(name = "DossenClient", url = "${feign.url.dossen}")
@RequestMapping(headers = {"accept=application/json", "Content-Type=application/json;charset=UTF-8"})
public interface DossenClient {
    /**
     * 获取Token
     */
    @GetMapping("/api/token")
    DossenResult<String> token(@RequestParam("App-Id") String appId,
                               @RequestParam("Key") String key);


    /**
     * 获取城市
     */
    @PostMapping(value = "/api/hotel/getCityList",headers = {"Content-Length=0"})
    DossenResult<List<DossenCityData>> getCitiesList(@RequestHeader MultiValueMap<String, String> headers,
                                                     @RequestBody Map emptyJson
    );

    /**
     * 获取酒店信息
     */
    @PostMapping("/api/hotel/getHotelInfo")
    DossenResult<List<DossenHotelData>> getHotelInfo(@RequestHeader MultiValueMap<String, String> headers,
                                                     @RequestBody DossenGetHotelInfoReq dossenGetHotelInfoReq);

    /**
     * 获取酒店房型
     */
    @PostMapping("/api/hotel/getHotelRoomType")
    DossenResult<List<DossenRoomTypeData>> getHotelRoomType(@RequestHeader MultiValueMap<String, String> headers,
                                                            @RequestBody DossenGetHotelRoomTypeReq dossenGetHotelRoomTypeReq
    );

    /**
     * 获取活动规则
     */
    @PostMapping(value = "/api/ratePlan/getRatePlan", headers = {"Content-Length=0"})
    DossenResult<List<DossenRatePlanData>> getECRateplan(@RequestHeader MultiValueMap<String, String> headers,
                                                         @RequestBody Map emptyJson);

    /**
     * 获取价格和房量
     */
    @PostMapping("/api/roomStatus/getPriceAndCount")
    DossenResult<List<DossenPriceAndCountData>> getPriceAndCount(@RequestHeader MultiValueMap<String, String> headers,
                                                                 @RequestBody DossenGetPriceAndCountReq dossenGetPriceAndCountReq
    );

    /**
     * 校验实时房价房量
     */
    @PostMapping("/api/order/checkPriceAndCount")
    DossenResult<List<DossenPriceAndCountData>> checkPriceAndCount(@RequestHeader MultiValueMap<String, String> headers,
                                                                   @RequestBody DossenCheckPriceAndCountReq dossenCheckPriceAndCountReq
    );


    /**
     * 下单
     */
    @PostMapping("/api/order/addOrder")
    DossenResult<String> addOrder(@RequestHeader MultiValueMap<String, String> headers,
                                  @RequestBody DossenAddOrderReq dossenAddOrderReq
    );

    /**
     * 订单查询
     */
    @PostMapping("/api/order/getOrderList")
    DossenResult<List<DossenOrderData>> getOrders(@RequestHeader MultiValueMap<String, String> headers,
                                                  @RequestBody DossenGetOrdersReq dossenGetOrdersReq
    );

    /**
     * 订单取消
     */
    @PostMapping("/api/order/cancelOrder")
    DossenResult cancelOrder(@RequestHeader MultiValueMap<String, String> headers,
                             @RequestBody DossenCancelOrderReq dossenCancelOrderReq
    );
}
